
function updatePwd(waiter){
	$.ajax({
		type: "get",
		url:"/updaWaiter1",
		data:{"waiter":waiter},
		success:function(data){
			$("#boss_show").load(data.url);
		}
	});
	
}

function button_waiter(){
	var parms=$("#updatePwd").serialize();
	$.post("/updatePwd",parms,function(data){
		if(data.num>0){
			alert("修改成功!");
			$("#boss_show").load("http://localhost:8080/showWaiter");
		}else{
			alert("修改失败!");
			$("#boss_show").load("http://localhost:8080/showWaiter");
		}
	},"json")
}




function addWaiters(){
	var parms=	$("#waiter_show").serialize();
	$.post("/addWaiter",parms,function(data){
		if(data.num>0){
			alert("添加成功!");
		}else{
			alert("添加失败!");
		}
	});
}

function updaBossPwd(userId){
	$("#boss_show").html(" ");
	var updaBoss="<form  method='post' id='updaBossPwd'><input type='text' " +
			"name='userId' value='"+userId+"' hidden='hidden'><br>"
				+"旧&nbsp;&nbsp;密&nbsp;&nbsp;码:&nbsp;<input" +
						" type='password' name='userPassword'>	<br>"
				+"新&nbsp;&nbsp;密&nbsp;&nbsp;码:&nbsp;<input " +
						"type='password' name='userPassword_01'>	<br>"
				+"确认密码:&nbsp;<input type='password' " +
						"name='userPassword_02'><br>"
				+"<input style='width:25% ;margin-left: " +
						"60px' type='button' onclick='tiJiaoBoss()'" +
						" value='提交'>&nbsp;&nbsp;"
				+"<input style='width:25% ' type='reset' value='重置'>"
			+"</form>";
	$("#boss_show").html(updaBoss);
}

function tiJiaoBoss() {
	var updaPwd=$("#updaBossPwd").serialize();
	$.post("/updaBossPwd",updaPwd,function(data){
		if(data.suceess){
			alert("修改成功！");
			location.replace(data.url)
		}else{
			alert("修改失败！");
		}
	},"json");
}



function selectWiter() {
	$("#boss_show").html(" ");
	$.ajax({
		url:"/getWaiter",
		success:function(){
			$("#boss_show").load("http://localhost:8080/showWaiter");
		}
	});
}
function delWaiter(waiterId){
	if(confirm("确认删除吗？")){
		$.ajax({
			type: "get",
			data:{"waiterId":waiterId},
			url:"/delWaiter",
			success:function(data){
				if(data.num>0){
					alert("删除成功!");
				}else{
					alert("删除失败!");
				}
			},
			dataType:"json"
		});
	}
}




function createWiter() {
	$("#boss_show").html(" ");
	$("#boss_show").load("http://localhost:8080/waiter");
}





function acc() {
	$("#boss_show").html(" ");
	alert("3");
}
